package shuogg.test.rabbitmqTest;

import java.io.IOException;
import java.io.Serializable;

import org.apache.commons.lang.SerializationUtils;

public class Producer extends EndPoint {

    public Producer(String endpointName) throws IOException {
        super(endpointName);
    }

    /**
     * @description 将object作为消息并发送出去
     * @param object
     * @throws IOException
     */
    public void sendMessage(Serializable object) throws IOException {
        // 核心方法--发送消息
        channel.basicPublish("", endPointName, null, SerializationUtils.serialize(object));
    }

}
